<html>
<head><meta charset="utf-8"><title>discuss constants and normalization · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html">discuss constants and normalization</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="170712779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712779">(Jul 12 2019 at 10:57)</a>:</h4>
<p>my take on this is that we should always erase lifetimes (<em>not</em> inner late-bound ones though!) in the <code>Substs</code>/<code>ParamEnv</code> when we const-eval anything (and maybe sure to not return a <code>Ty</code>/<code>Substs</code> from const-eval, so the user is forced to reuse the original type to make a <code>ty::Const</code> and doesn't risk losing information etc.)</p>



<a name="170712783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712783">(Jul 12 2019 at 10:57)</a>:</h4>
<p>ok I added an event to help me remember :) maybe <span class="user-mention" data-user-id="124288">@oli</span>, <span class="user-mention" data-user-id="121053">@varkor</span>, or others will be able to make it, but maybe not? I forget -- there was one other person working on the const generics PR -- but I forgot their name?</p>



<a name="170712794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712794">(Jul 12 2019 at 10:57)</a>:</h4>
<p>say more, why are lifetimes the problem?</p>



<a name="170712847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712847">(Jul 12 2019 at 10:58)</a>:</h4>
<p>though I think I remember adding an <code>erase_lifetimes</code> step at some point when trying to untangle the current code</p>



<a name="170712858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712858">(Jul 12 2019 at 10:58)</a>:</h4>
<p>they're not, but we don't need to canonicalize them. I remember you yourself hit lifetime inference vars at some point</p>



<a name="170712903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712903">(Jul 12 2019 at 10:59)</a>:</h4>
<p>and for type/const infer vars, we can canonicalize <em>but</em> it doesn't have to be a proper canonicalization query because there is no inference going on in miri and it would just rely on placeholders as opaque things</p>



<a name="170712910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712910">(Jul 12 2019 at 11:00)</a>:</h4>
<p>so it's more like the old "freshening"</p>



<a name="170712965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170712965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170712965">(Jul 12 2019 at 11:00)</a>:</h4>
<p>and we just make layout return a layout error instead of ICE-ing, for those placeholders</p>



<a name="170713007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170713007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170713007">(Jul 12 2019 at 11:01)</a>:</h4>
<p>so some things will fail (if they need further inference to progress) while others will work just fine (e.g. parameters in scope that aren't used by the constant MIR itself, but were instantiated with inference vars)</p>



<a name="170713069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170713069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170713069">(Jul 12 2019 at 11:02)</a>:</h4>
<p>and that should be enough to handle everything without disallowing <code>ty::Const</code>s that used to fail "<code>lift_to_global</code>" (i.e. that contain inference vars)</p>



<a name="170713086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170713086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170713086">(Jul 12 2019 at 11:03)</a>:</h4>
<p>which means that even without early normalization, the implementation will have less cases in which it just gives up</p>



<a name="170713093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170713093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170713093">(Jul 12 2019 at 11:03)</a>:</h4>
<p>I wish I thought of using freshening back when I added all of those cases :/</p>



<a name="170715339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170715339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170715339">(Jul 12 2019 at 11:50)</a>:</h4>
<p>I can't make a meeting this week</p>



<a name="170715351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170715351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170715351">(Jul 12 2019 at 11:51)</a>:</h4>
<p>Next week Monday or Friday is OK though.</p>



<a name="170717246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170717246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170717246">(Jul 12 2019 at 12:26)</a>:</h4>
<p>I'm not able to make a meeting today either; the latter half of next week would work though.</p>



<a name="170717262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170717262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170717262">(Jul 12 2019 at 12:26)</a>:</h4>
<p><span class="user-mention" data-user-id="218608">@yodal</span> was the other person involved with const generics.</p>



<a name="170718193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170718193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170718193">(Jul 12 2019 at 12:42)</a>:</h4>
<p>I can try to make it to any meeting, but I can make no promises and I don't know how much input I will be able to provide</p>



<a name="170718213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170718213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170718213">(Jul 12 2019 at 12:42)</a>:</h4>
<p>I've been gone from the rustc scene for almost two months now due to work</p>



<a name="170724018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724018">(Jul 12 2019 at 13:58)</a>:</h4>
<p>Well <span class="user-mention" data-user-id="119009">@eddyb</span> even if the others aren't around, do you want to talk about constants and normalization? I'd be happy to schedule a time to chat when others can't make it, too, but also happy to discuss a bit beforehand. :)</p>



<a name="170724051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724051">(Jul 12 2019 at 13:59)</a>:</h4>
<p>sure</p>



<a name="170724052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724052">(Jul 12 2019 at 13:59)</a>:</h4>
<p>(deleted)</p>



<a name="170724078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724078">(Jul 12 2019 at 13:59)</a>:</h4>
<p>you mean <a href="#narrow/stream/131828-t-compiler/topic/.60unwrap_usize.60.20should.20at.20least.20try.20.2359369/near/170712858" title="#narrow/stream/131828-t-compiler/topic/.60unwrap_usize.60.20should.20at.20least.20try.20.2359369/near/170712858">these comments</a>?</p>



<a name="170724093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724093">(Jul 12 2019 at 13:59)</a>:</h4>
<p>I created a new topic but we can pop back to that one :)</p>



<a name="170724102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724102">(Jul 12 2019 at 14:00)</a>:</h4>
<p>hi <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="170724227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724227">(Jul 12 2019 at 14:01)</a>:</h4>
<p>I'm not 100% sure where I'd like to start but -- to refresh my memory -- <a href="https://github.com/rust-lang/rust/issues/59369" target="_blank" title="https://github.com/rust-lang/rust/issues/59369">#59369</a> basically tries to evaluate constants when it would otherwise error</p>



<a name="170724340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724340">(Jul 12 2019 at 14:03)</a>:</h4>
<p>there are various <code>unwrap</code> calls from the rests of lifts and things where it's not obvious to me that they make sense</p>



<a name="170724347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724347">(Jul 12 2019 at 14:03)</a>:</h4>
<p>I kind of want to step back and just outline how we think things <em>should</em> be working ideally</p>



<a name="170724379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724379">(Jul 12 2019 at 14:03)</a>:</h4>
<p>(deleted)</p>



<a name="170724433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724433">(Jul 12 2019 at 14:04)</a>:</h4>
<p>ideally we never "fail to lift"</p>



<a name="170724445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724445">(Jul 12 2019 at 14:04)</a>:</h4>
<p>ok</p>



<a name="170724448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724448">(Jul 12 2019 at 14:04)</a>:</h4>
<p>I combined the two zulip topics into one now :P</p>



<a name="170724476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724476">(Jul 12 2019 at 14:05)</a>:</h4>
<p>anyway, I agree we should never fail to lift, because presumably we should be canonicalizing</p>



<a name="170724502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724502">(Jul 12 2019 at 14:05)</a>:</h4>
<p>and for now, I'd prefer to gracefully fail, just like today, if we want to merge something</p>



<a name="170724506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724506">(Jul 12 2019 at 14:05)</a>:</h4>
<p>(note that erasing regions isn't really all that relevant, since they get "normalized" when you canonicalize anyway)</p>



<a name="170724511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724511">(Jul 12 2019 at 14:05)</a>:</h4>
<p>because we're turning user errors into ICEs if we have <code>.unwrap()</code> there</p>



<a name="170724518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724518">(Jul 12 2019 at 14:06)</a>:</h4>
<p>that makes sense</p>



<a name="170724563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724563">(Jul 12 2019 at 14:06)</a>:</h4>
<p>yeah I just think it's a waste to canonicalize lifetimes :P</p>



<a name="170724565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724565">(Jul 12 2019 at 14:06)</a>:</h4>
<p>can you give me a sense for when this <code>try_eval_bits</code> code is going to get called?</p>



<a name="170724596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724596">(Jul 12 2019 at 14:06)</a>:</h4>
<p>it's basically lazy normalization for anything that wants the concrete value of a <code>ty::Const</code></p>



<a name="170724603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724603">(Jul 12 2019 at 14:06)</a>:</h4>
<p>usually things that check the length of an array type</p>



<a name="170724613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724613">(Jul 12 2019 at 14:07)</a>:</h4>
<p>which presumably we eventually want</p>



<a name="170724632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724632">(Jul 12 2019 at 14:07)</a>:</h4>
<p>like layout (which needs to report a layout error, not ICE) or various checks that special-case <code>0</code> (which can be conservative if the value is unknown)</p>



<a name="170724648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724648">(Jul 12 2019 at 14:07)</a>:</h4>
<p>right, ok</p>



<a name="170724734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724734">(Jul 12 2019 at 14:09)</a>:</h4>
<p>I'm trying to figure out what I want to ask</p>



<a name="170724831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724831">(Jul 12 2019 at 14:11)</a>:</h4>
<p>last time I was digging in this code I felt like:</p>
<ul>
<li>obviously I want to do lazy norm (and I've been thinking a bit about how best to proceed there, which we could discuss separately)</li>
<li>but also I'm not clear why const generics are any different than the rest of the code, it feels like we could use the same "eager norm fixed point" scheme that we use for other projections</li>
</ul>



<a name="170724843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724843">(Jul 12 2019 at 14:11)</a>:</h4>
<p>but it was a bit hard to investigate the latter because the setup was kind of "different"</p>



<a name="170724932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724932">(Jul 12 2019 at 14:12)</a>:</h4>
<p>specifically i'm not sure why <code>where Foo&lt;SomeType::Item&gt;: Bar</code> is different from <code>[T; SomeConstant]</code></p>



<a name="170724949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170724949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170724949">(Jul 12 2019 at 14:12)</a>:</h4>
<p>but in any case, maybe I can just outline what I <em>think</em> the intended design is and you can kind of correct me</p>



<a name="170725080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170725080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170725080">(Jul 12 2019 at 14:14)</a>:</h4>
<p>sorry, got distracted chasing down a few types</p>



<a name="170725088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170725088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170725088">(Jul 12 2019 at 14:15)</a>:</h4>
<p>in particular I just remembered that one of the things this PR changes is something to do with how <code>ConstValue</code> works, right?</p>



<a name="170725205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/discuss%20constants%20and%20normalization/near/170725205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/discuss.20constants.20and.20normalization.html#170725205">(Jul 12 2019 at 14:16)</a>:</h4>
<p>ok, well, given that <span class="user-mention" data-user-id="124288">@oli</span> and others can't attend -- perhaps we can schedule another time to dig, and I'll read into the code in the meantime. <span class="user-mention" data-user-id="119009">@eddyb</span> I'm going to reassign that PR to you for review, I <em>think</em> I am fine with it, if I understand what's going on.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>